home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / pisces / flex / flexdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-04  |  21.5 KB  |  610 lines

  1. /* flexdef - definitions file for flex */
  2.  
  3. /*
  4.  * Copyright (c) 1989 The Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * This code is derived from software contributed to Berkeley by
  8.  * Vern Paxson.
  9.  * 
  10.  * The United States Government has rights in this work pursuant to
  11.  * contract no. DE-AC03-76SF00098 between the United States Department of
  12.  * Energy and the University of California.
  13.  *
  14.  * Redistribution and use in source and binary forms are permitted
  15.  * provided that the above copyright notice and this paragraph are
  16.  * duplicated in all such forms and that any documentation,
  17.  * advertising materials, and other materials related to such
  18.  * distribution and use acknowledge that the software was developed
  19.  * by the University of California, Berkeley.  The name of the
  20.  * University may not be used to endorse or promote products derived
  21.  * from this software without specific prior written permission.
  22.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  23.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  24.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  25.  */
  26.  
  27. /* @(#) $Header: /tan/u1/neath/pisces/flex/RCS/flexdef.h,v 1.2 90/05/15 13:20:45 neath Exp $ (LBL) */
  28.  
  29. #ifndef FILE
  30. #include <stdio.h>
  31. #endif
  32.  
  33. #include <string.h>
  34.  
  35. #ifdef SYS_V
  36.  
  37. #ifdef AMIGA
  38. #define bzero(s, n) setmem((char *)(s), (unsigned)(n), '\0')
  39. #define abs(x) ((x) < 0 ? -(x) : (x))
  40. #else
  41. #define bzero(s, n) memset((char *)(s), '\0', (unsigned)(n))
  42. #endif
  43.  
  44. #ifndef VMS
  45. char *memset();
  46. #else
  47. /* memset is needed for old versions of the VMS C runtime library */
  48. #define memset(s, c, n) \
  49.     { \
  50.     register char *t = s; \
  51.     register unsigned int m = n; \
  52.     while ( m-- > 0 ) \
  53.         *t++ = c; \
  54.     }
  55. #define unlink delete
  56. #define SHORT_FILE_NAMES
  57. #endif
  58. #endif
  59.  
  60. #ifndef SYS_V
  61. #ifdef lint
  62. char *sprintf(); /* keep lint happy */
  63. #endif
  64. #endif
  65.  
  66.  
  67. /* maximum line length we'll have to deal with */
  68. #define MAXLINE BUFSIZ
  69.  
  70. /* maximum size of file name */
  71. #define FILENAMESIZE 1024
  72.  
  73. #define min(x,y) ((x) < (y) ? (x) : (y))
  74. #define max(x,y) ((x) > (y) ? (x) : (y))
  75.  
  76. #ifdef MS_DOS
  77. #define abs(x) ((x) < 0 ? -(x) : (x))
  78. #define SHORT_FILE_NAMES
  79. #endif
  80.  
  81. #define true 1
  82. #define false 0
  83.  
  84.  
  85. #ifndef DEFAULT_SKELETON_FILE
  86. #define DEFAULT_SKELETON_FILE "flex.skel"
  87. #endif
  88.  
  89. /* special chk[] values marking the slots taking by end-of-buffer and action
  90.  * numbers
  91.  */
  92. #define EOB_POSITION -1
  93. #define ACTION_POSITION -2
  94.  
  95. /* number of data items per line for -f output */
  96. #define NUMDATAITEMS 10
  97.  
  98. /* number of lines of data in -f output before inserting a blank line for
  99.  * readability.
  100.  */
  101. #define NUMDATALINES 10
  102.  
  103. /* transition_struct_out() definitions */
  104. #define TRANS_STRUCT_PRINT_LENGTH 15
  105.  
  106. /* returns true if an nfa state has an epsilon out-transition slot
  107.  * that can be used.  This definition is currently not used.
  108.  */
  109. #define FREE_EPSILON(state) \
  110.     (transchar[state] == SYM_EPSILON && \
  111.      trans2[state] == NO_TRANSITION && \
  112.      finalst[state] != state)
  113.  
  114. /* returns true if an nfa state has an epsilon out-transition character
  115.  * and both slots are free
  116.  */
  117. #define SUPER_FREE_EPSILON(state) \
  118.     (transchar[state] == SYM_EPSILON && \
  119.      trans1[state] == NO_TRANSITION) \
  120.  
  121. /* maximum number of NFA states that can comprise a DFA state.  It's real
  122.  * big because if there's a lot of rules, the initial state will have a
  123.  * huge epsilon closure.
  124.  */
  125. #define INITIAL_MAX_DFA_SIZE 750
  126. #define MAX_DFA_SIZE_INCREMENT 750
  127.  
  128. /* array names to be used in generated machine.  They're short because
  129.  * we write out one data statement (which names the array) for each element
  130.  * in the array.
  131.  */
  132.  
  133. /* points to list of rules accepted for a state */
  134. #define ALIST "yy_accept"
  135. #define ACCEPT "yy_acclist"    /* list of rules accepted for a state */
  136. #define ECARRAY "yy_ec"    /* maps input characters to equivalence classes */
  137. /* maps equivalence classes to meta-equivalence classes */
  138. #define MATCHARRAY "yy_meta"
  139. #define BASEARRAY "yy_base"    /* "base" array */
  140. #define DEFARRAY "yy_def"    /* "default" array */
  141. #define NEXTARRAY "yy_nxt"    /* "next" array */
  142. #define CHECKARRAY "yy_chk"    /* "check" array */
  143.  
  144.  
  145. /* a note on the following masks.  They are used to mark accepting numbers
  146.  * as being special.  As such, they implicitly limit the number of accepting
  147.  * numbers (i.e., rules) because if there are too many rules the rule numbers
  148.  * will overload the mask bits.  Fortunately, this limit is \large/ (0x2000 ==
  149.  * 8192) so unlikely to actually cause any problems.  A check is made in
  150.  * new_rule() to ensure that this limit is not reached.
  151.  */
  152.  
  153. /* mask to mark a trailing context accepting number */
  154. #define YY_TRAILING_MASK 0x2000
  155.  
  156. /* mask to mark the accepting number of the "head" of a trailing context rule */
  157. #define YY_TRAILING_HEAD_MASK 0x4000
  158.  
  159. /* maximum number of rules, as outlined in the above note */
  160. #define MAX_RULE (YY_TRAILING_MASK - 1)
  161.  
  162.  
  163. /* NIL must be 0.  If not, its special meaning when making equivalence classes
  164.  * (it marks the representative of a given e.c.) will be unidentifiable
  165.  */
  166. #define NIL 0
  167.  
  168. #define JAM -1    /* to mark a missing DFA transition */
  169. #define NO_TRANSITION NIL
  170. #define UNIQUE -1    /* marks a symbol as an e.c. representative */
  171. #define INFINITY -1    /* for x{5,} constructions */
  172.  
  173. /* size of input alphabet - should be size of ASCII set */
  174. #define CSIZE 127
  175.  
  176. #define INITIAL_MAX_CCLS 100    /* max number of unique character classes */
  177. #define MAX_CCLS_INCREMENT 100
  178.  
  179. /* size of table holding members of character classes */
  180. #define INITIAL_MAX_CCL_TBL_SIZE 500
  181. #define MAX_CCL_TBL_SIZE_INCREMENT 250
  182.  
  183. #define INITIAL_MAX_RULES 100    /* default maximum number of rules */
  184. #define MAX_RULES_INCREMENT 100
  185.  
  186. #define INITIAL_MNS 2000    /* default maximum number of nfa states */
  187. #define MNS_INCREMENT 1000    /* amount to bump above by if it's not enough */
  188.  
  189. #define INITIAL_MAX_DFAS 1000    /* default maximum number of dfa states */
  190. #define MAX_DFAS_INCREMENT 1000
  191.  
  192. #define JAMSTATE -32766    /* marks a reference to the state that always jams */
  193.  
  194. /* enough so that if it's subtracted from an NFA state number, the result
  195.  * is guaranteed to be negative
  196.  */
  197. #define MARKER_DIFFERENCE 32000
  198. #define MAXIMUM_MNS 31999
  199.  
  200. /* maximum number of nxt/chk pairs for non-templates */
  201. #define INITIAL_MAX_XPAIRS 2000
  202. #define MAX_XPAIRS_INCREMENT 2000
  203.  
  204. /* maximum number of nxt/chk pairs needed for templates */
  205. #define INITIAL_MAX_TEMPLATE_XPAIRS 2500
  206. #define MAX_TEMPLATE_XPAIRS_INCREMENT 2500
  207.  
  208. #define SYM_EPSILON 0    /* to mark transitions on the symbol epsilon */
  209.  
  210. #define INITIAL_MAX_SCS 40    /* maximum number of start conditions */
  211. #define MAX_SCS_INCREMENT 40    /* amount to bump by if it's not enough */
  212.  
  213. #define ONE_STACK_SIZE 500    /* stack of states with only one out-transition */
  214. #define SAME_TRANS -1    /* transition is the same as "default" entry for state */
  215.  
  216. /* the following percentages are used to tune table compression:
  217.  
  218.  * the percentage the number of out-transitions a state must be of the
  219.  * number of equivalence classes in order to be considered for table
  220.  * compaction by using protos
  221.  */
  222. #define PROTO_SIZE_PERCENTAGE 15
  223.  
  224. /* the percentage the number of homogeneous out-transitions of a state
  225.  * must be of the number of total out-transitions of the state in order
  226.  * that the state's transition table is first compared with a potential 
  227.  * template of the most common out-transition instead of with the first
  228.  * proto in the proto queue
  229.  */
  230. #define CHECK_COM_PERCENTAGE 50
  231.  
  232. /* the percentage the number of differences between a state's transition
  233.  * table and the proto it was first compared with must be of the total
  234.  * number of out-transitions of the state in order to keep the first
  235.  * proto as a good match and not search any further
  236.  */
  237. #define FIRST_MATCH_DIFF_PERCENTAGE 10
  238.  
  239. /* the percentage the number of differences between a state's transition
  240.  * table and the most similar proto must be of the state's total number
  241.  * of out-transitions to use the proto as an acceptable close match
  242.  */
  243. #define ACCEPTABLE_DIFF_PERCENTAGE 50
  244.  
  245. /* the percentage the number of homogeneous out-transitions of a state
  246.  * must be of the number of total out-transitions of the state in order
  247.  * to consider making a template from the state
  248.  */
  249. #define TEMPLATE_SAME_PERCENTAGE 60
  250.  
  251. /* the percentage the number of differences between a state's transition
  252.  * table and the most similar proto must be of the state's total number
  253.  * of out-transitions to create a new proto from the state
  254.  */
  255. #define NEW_PROTO_DIFF_PERCENTAGE 20
  256.  
  257. /* the percentage the total number of out-transitions of a state must be
  258.  * of the number of equivalence classes in order to consider trying to
  259.  * fit the transition table into "holes" inside the nxt/chk table.
  260.  */
  261. #define INTERIOR_FIT_PERCENTAGE 15
  262.  
  263. /* size of region set aside to cache the complete transition table of
  264.  * protos on the proto queue to enable quick comparisons
  265.  */
  266. #define PROT_SAVE_SIZE 2000
  267.  
  268. #define MSP 50    /* maximum number of saved protos (protos on the proto queue) */
  269.  
  270. /* maximum number of out-transitions a state can have that we'll rummage
  271.  * around through the interior of the internal fast table looking for a
  272.  * spot for it
  273.  */
  274. #define MAX_XTIONS_FULL_INTERIOR_FIT 4
  275.  
  276. /* maximum number of rules which will be reported as being associated
  277.  * with a DFA state
  278.  */
  279. #define MAX_ASSOC_RULES 100
  280.  
  281. /* number that, if used to subscript an array, has a good chance of producing
  282.  * an error; should be small enough to fit into a short
  283.  */
  284. #define BAD_SUBSCRIPT -32767
  285.  
  286. /* absolute value of largest number that can be stored in a short, with a
  287.  * bit of slop thrown in for general paranoia.
  288.  */
  289. #define MAX_SHORT 32766
  290.  
  291.  
  292. /* Declarations for global variables. */
  293.  
  294. /* variables for symbol tables:
  295.  * sctbl - start-condition symbol table
  296.  * ndtbl - name-definition symbol table
  297.  * ccltab - character class text symbol table
  298.  */
  299.  
  300. struct hash_entry
  301.     {
  302.     struct hash_entry *prev, *next;
  303.     char *name;
  304.     char *str_val;
  305.     int int_val;
  306.     } ;
  307.  
  308. typedef struct hash_entry *hash_table[];
  309.  
  310. #define NAME_TABLE_HASH_SIZE 101
  311. #define START_COND_HASH_SIZE 101
  312. #define CCL_HASH_SIZE 101
  313.  
  314. extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; 
  315. extern struct hash_entry *sctbl[START_COND_HASH_SIZE];
  316. extern struct hash_entry *ccltab[CCL_HASH_SIZE];
  317.  
  318.  
  319. /* variables for flags:
  320.  * printstats - if true (-v), dump statistics
  321.  * syntaxerror - true if a syntax error has been found
  322.  * eofseen - true if we've seen an eof in the input file
  323.  * ddebug - if true (-d), make a "debug" scanner
  324.  * trace - if true (-T), trace processing
  325.  * spprdflt - if true (-s), suppress the default rule
  326.  * cplusplus - if true (-C), generates a C++ 2.0 compatible skeleton file
  327.  * interactive - if true (-I), generate an interactive scanner
  328.  * caseins - if true (-i), generate a case-insensitive scanner
  329.  * useecs - if true (-ce flag), use equivalence classes
  330.  * fulltbl - if true (-cf flag), don't compress the DFA state table
  331.  * usemecs - if true (-cm flag), use meta-equivalence classes
  332.  * fullspd - if true (-F flag), use Jacobson method of table representation
  333.  * gen_line_dirs - if true (i.e., no -L flag), generate #line directives
  334.  * performance_report - if true (i.e., -p flag), generate a report relating
  335.  *   to scanner performance
  336.  * backtrack_report - if true (i.e., -b flag), generate "lex.backtrack" file
  337.  *   listing backtracking states
  338.  * yymore_used - if true, yymore() is used in input rules
  339.  * reject - if true, generate backtracking tables for REJECT macro
  340.  * real_reject - if true, scanner really uses REJECT (as opposed to just
  341.  *               having "reject" set for variable trailing context)
  342.  * continued_action - true if this rule's action is to "fall through" to
  343.  *                    the next rule's action (i.e., the '|' action)
  344.  * yymore_really_used - has a REALLY_xxx value indicating whether a
  345.  *                      %used or %notused was used with yymore()
  346.  * reject_really_used - same for REJECT
  347.  */
  348.  
  349. extern int printstats, syntaxerror, eofseen, ddebug, trace, spprdflt;
  350. extern int interactive, caseins, useecs, fulltbl, usemecs, cplusplus;
  351. extern int fullspd, gen_line_dirs, performance_report, backtrack_report;
  352. extern int yymore_used, reject, real_reject, continued_action;
  353.  
  354. #define REALLY_NOT_DETERMINED 0
  355. #define REALLY_USED 1
  356. #define REALLY_NOT_USED 2
  357. extern int yymore_really_used, reject_really_used;
  358.  
  359.  
  360. /* variables used in the flex input routines:
  361.  * datapos - characters on current output line
  362.  * dataline - number of contiguous lines of data in current data
  363.  *    statement.  Used to generate readable -f output
  364.  * skelfile - the skeleton file
  365.  * yyin - input file
  366.  * temp_action_file - temporary file to hold actions
  367.  * backtrack_file - file to summarize backtracking states to
  368.  * action_file_name - name of the temporary file
  369.  * infilename - name of input file
  370.  * linenum - current input line number
  371.  */
  372.  
  373. extern int datapos, dataline, linenum;
  374. extern FILE *skelfile, *yyin, *temp_action_file, *backtrack_file;
  375. extern char *infilename;
  376. extern char action_file_name[];
  377.  
  378.  
  379. /* variables for stack of states having only one out-transition:
  380.  * onestate - state number
  381.  * onesym - transition symbol
  382.  * onenext - target state
  383.  * onedef - default base entry
  384.  * onesp - stack pointer
  385.  */
  386.  
  387. extern int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
  388. extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
  389.  
  390.  
  391. /* variables for nfa machine data:
  392.  * current_mns - current maximum on number of NFA states
  393.  * num_rules - number of the last accepting state; also is number of
  394.  *             rules created so far
  395.  * current_max_rules - current maximum number of rules
  396.  * lastnfa - last nfa state number created
  397.  * firstst - physically the first state of a fragment
  398.  * lastst - last physical state of fragment
  399.  * finalst - last logical state of fragment
  400.  * transchar - transition character
  401.  * trans1 - transition state
  402.  * trans2 - 2nd transition state for epsilons
  403.  * accptnum - accepting number
  404.  * assoc_rule - rule associated with this NFA state (or 0 if none)
  405.  * state_type - a STATE_xxx type identifying whether the state is part
  406.  *              of a normal rule, the leading state in a trailing context
  407.  *              rule (i.e., the state which marks the transition from
  408.  *              recognizing the text-to-be-matched to the beginning of
  409.  *              the trailing context), or a subsequent state in a trailing
  410.  *              context rule
  411.  * rule_type - a RULE_xxx type identifying whether this a a ho-hum
  412.  *             normal rule or one which has variable head & trailing
  413.  *             context
  414.  * rule_linenum - line number associated with rule
  415.  */
  416.  
  417. extern int current_mns, num_rules, current_max_rules, lastnfa;
  418. extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
  419. extern int *accptnum, *assoc_rule, *state_type, *rule_type, *rule_linenum;
  420.  
  421. /* different types of states; values are useful as masks, as well, for
  422.  * routines like check_trailing_context()
  423.  */
  424. #define STATE_NORMAL 0x1
  425. #define STATE_TRAILING_CONTEXT 0x2
  426.  
  427. /* global holding current type of state we're making */
  428.  
  429. extern int current_state_type;
  430.  
  431. /* different types of rules */
  432. #define RULE_NORMAL 0
  433. #define RULE_VARIABLE 1
  434.  
  435. /* true if the input rules include a rule with both variable-length head
  436.  * and trailing context, false otherwise
  437.  */
  438. extern int variable_trailing_context_rules;
  439.  
  440.  
  441. /* variables for protos:
  442.  * numtemps - number of templates created
  443.  * numprots - number of protos created
  444.  * protprev - backlink to a more-recently used proto
  445.  * protnext - forward link to a less-recently used proto
  446.  * prottbl - base/def table entry for proto
  447.  * protcomst - common state of proto
  448.  * firstprot - number of the most recently used proto
  449.  * lastprot - number of the least recently used proto
  450.  * protsave contains the entire state array for protos
  451.  */
  452.  
  453. extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
  454. extern int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
  455.  
  456.  
  457. /* variables for managing equivalence classes:
  458.  * numecs - number of equivalence classes
  459.  * nextecm - forward link of Equivalence Class members
  460.  * ecgroup - class number or backward link of EC members
  461.  * nummecs - number of meta-equivalence classes (used to compress
  462.  *   templates)
  463.  * tecfwd - forward link of meta-equivalence classes members
  464.  * tecbck - backward link of MEC's
  465.  */
  466.  
  467. extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;
  468. extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];
  469.  
  470.  
  471. /* variables for start conditions:
  472.  * lastsc - last start condition created
  473.  * current_max_scs - current limit on number of start conditions
  474.  * scset - set of rules active in start condition
  475.  * scbol - set of rules active only at the beginning of line in a s.c.
  476.  * scxclu - true if start condition is exclusive
  477.  * sceof - true if start condition has EOF rule
  478.  * scname - start condition name
  479.  * actvsc - stack of active start conditions for the current rule
  480.  */
  481.  
  482. extern int lastsc, current_max_scs, *scset, *scbol, *scxclu, *sceof, *actvsc;
  483. extern char **scname;
  484.  
  485.  
  486. /* variables for dfa machine data:
  487.  * current_max_dfa_size - current maximum number of NFA states in DFA
  488.  * current_max_xpairs - current maximum number of non-template xtion pairs
  489.  * current_max_template_xpairs - current maximum number of template pairs
  490.  * current_max_dfas - current maximum number DFA states
  491.  * lastdfa - last dfa state number created
  492.  * nxt - state to enter upon reading character
  493.  * chk - check value to see if "nxt" applies
  494.  * tnxt - internal nxt table for templates
  495.  * base - offset into "nxt" for given state
  496.  * def - where to go if "chk" disallows "nxt" entry
  497.  * tblend - last "nxt/chk" table entry being used
  498.  * firstfree - first empty entry in "nxt/chk" table
  499.  * dss - nfa state set for each dfa
  500.  * dfasiz - size of nfa state set for each dfa
  501.  * dfaacc - accepting set for each dfa state (or accepting number, if
  502.  *    -r is not given)
  503.  * accsiz - size of accepting set for each dfa state
  504.  * dhash - dfa state hash value
  505.  * numas - number of DFA accepting states created; note that this
  506.  *    is not necessarily the same value as num_rules, which is the analogous
  507.  *    value for the NFA
  508.  * numsnpairs - number of state/nextstate transition pairs
  509.  * jambase - position in base/def where the default jam table starts
  510.  * jamstate - state number corresponding to "jam" state
  511.  * end_of_buffer_state - end-of-buffer dfa state number
  512.  */
  513.  
  514. extern int current_max_dfa_size, current_max_xpairs;
  515. extern int current_max_template_xpairs, current_max_dfas;
  516. extern int lastdfa, lasttemp, *nxt, *chk, *tnxt;
  517. extern int *base, *def, tblend, firstfree, **dss, *dfasiz;
  518. extern union dfaacc_union
  519.     {
  520.     int *dfaacc_set;
  521.     int dfaacc_state;
  522.     } *dfaacc;
  523. extern int *accsiz, *dhash, numas;
  524. extern int numsnpairs, jambase, jamstate;
  525. extern int end_of_buffer_state;
  526.  
  527. /* variables for ccl information:
  528.  * lastccl - ccl index of the last created ccl
  529.  * current_maxccls - current limit on the maximum number of unique ccl's
  530.  * cclmap - maps a ccl index to its set pointer
  531.  * ccllen - gives the length of a ccl
  532.  * cclng - true for a given ccl if the ccl is negated
  533.  * cclreuse - counts how many times a ccl is re-used
  534.  * current_max_ccl_tbl_size - current limit on number of characters needed
  535.  *    to represent the unique ccl's
  536.  * ccltbl - holds the characters in each ccl - indexed by cclmap
  537.  */
  538.  
  539. extern int lastccl, current_maxccls, *cclmap, *ccllen, *cclng, cclreuse;
  540. extern int current_max_ccl_tbl_size;
  541. extern char *ccltbl;
  542.  
  543.  
  544. /* variables for miscellaneous information:
  545.  * starttime - real-time when we started
  546.  * endtime - real-time when we ended
  547.  * nmstr - last NAME scanned by the scanner
  548.  * sectnum - section number currently being parsed
  549.  * nummt - number of empty nxt/chk table entries
  550.  * hshcol - number of hash collisions detected by snstods
  551.  * dfaeql - number of times a newly created dfa was equal to an old one
  552.  * numeps - number of epsilon NFA states created
  553.  * eps2 - number of epsilon states which have 2 out-transitions
  554.  * num_reallocs - number of times it was necessary to realloc() a group
  555.  *          of arrays
  556.  * tmpuses - number of DFA states that chain to templates
  557.  * totnst - total number of NFA states used to make DFA states
  558.  * peakpairs - peak number of transition pairs we had to store internally
  559.  * numuniq - number of unique transitions
  560.  * numdup - number of duplicate transitions
  561.  * hshsave - number of hash collisions saved by checking number of states
  562.  * num_backtracking - number of DFA states requiring back-tracking
  563.  * bol_needed - whether scanner needs beginning-of-line recognition
  564.  */
  565.  
  566. extern char *starttime, *endtime, nmstr[MAXLINE];
  567. extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
  568. extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
  569. extern int num_backtracking, bol_needed;
  570.  
  571. char *allocate_array(), *reallocate_array();
  572.  
  573. #define allocate_integer_array(size) \
  574.     (int *) allocate_array( size, sizeof( int ) )
  575.  
  576. #define reallocate_integer_array(array,size) \
  577.     (int *) reallocate_array( (char *) array, size, sizeof( int ) )
  578.  
  579. #define allocate_int_ptr_array(size) \
  580.     (int **) allocate_array( size, sizeof( int * ) )
  581.  
  582. #define allocate_char_ptr_array(size) \
  583.     (char **) allocate_array( size, sizeof( char * ) )
  584.  
  585. #define allocate_dfaacc_union(size) \
  586.     (union dfaacc_union *) \
  587.         allocate_array( size, sizeof( union dfaacc_union ) )
  588.  
  589. #define reallocate_int_ptr_array(array,size) \
  590.     (int **) reallocate_array( (char *) array, size, sizeof( int * ) )
  591.  
  592. #define reallocate_char_ptr_array(array,size) \
  593.     (char **) reallocate_array( (char *) array, size, sizeof( char * ) )
  594.  
  595. #define reallocate_dfaacc_union(array, size) \
  596.     (union dfaacc_union *)  reallocate_array( (char *) array, size, sizeof( union dfaacc_union ) )
  597.  
  598. #define allocate_character_array(size) allocate_array( size, sizeof( char ) )
  599.  
  600. #define reallocate_character_array(array,size) \
  601.     reallocate_array( array, size, sizeof( char ) )
  602.  
  603.  
  604. /* used to communicate between scanner and parser.  The type should really
  605.  * be YYSTYPE, but we can't easily get our hands on it.
  606.  */
  607. extern int yylval;
  608.  
  609.  
  610.